package com.huabo.contract.oracle.mapper;

import com.hbfk.util.DateUtil;
import com.huabo.contract.oracle.entity.TblCyhwBasicuninspection;

public class TblCyhwBasicuninspectionMapperSqlConfig {


    public String insertBybudget(TblCyhwBasicuninspection tcp) {
        StringBuffer column = new StringBuffer("INSERT INTO TBL_CYHW_BASICUNINSPECTION (INSPECTIONID");
        StringBuffer value = new StringBuffer(" VALUES (HIBERNATE_SEQUENCE.nextval");

        if(tcp.getInspectionname() != null && !"".equals(tcp.getInspectionname())) {
            column.append(",INSPECTIONNAME");
            value.append(",'"+tcp.getInspectionname()+"'");
        }
        if(tcp.getInspectionfunc() != null && !"".equals(tcp.getInspectionfunc())) {
            column.append(",INSPECTIONFUNC");
            value.append(",'"+tcp.getInspectionfunc()+"'");
        }
        if(tcp.getFilename() != null && !"".equals(tcp.getFilename())) {
            column.append(",FILENAME");
            value.append(",'"+tcp.getFilename()+"'");
        }
        if(tcp.getFileno() != null && !"".equals(tcp.getFileno())) {
            column.append(",FILENO");
            value.append(",'"+tcp.getFileno()+"'");
        }
        if(tcp.getInspectionmoney() != null && !"".equals(tcp.getInspectionmoney())) {
            column.append(",INSPECTIONMONEY");
            value.append(",'"+tcp.getInspectionmoney()+"'");
        }
        if(tcp.getInspectiondate() != null && !"".equals(tcp.getInspectiondate())) {
            column.append(",INSPECTIONDATE");
            value.append(",TO_DATE('"+ DateUtil.parseDate(tcp.getInspectiondate(),"yyyy-MM-dd HH:mm:ss") +"', 'YYYY-MM-DD HH24:MI:SS')");
        }
        if(tcp.getOrgid() != null && !"".equals(tcp.getOrgid())) {
            column.append(",ORGID");
            value.append(",'"+tcp.getOrgid()+"'");
        }
        if(tcp.getCreateuser() != null && !"".equals(tcp.getCreateuser())) {
            column.append(",CREATEUSER");
            value.append(",'"+tcp.getCreateuser()+"'");
        }
        if(tcp.getCreatetime() != null && !"".equals(tcp.getCreatetime())) {
            column.append(",CREATETIME");
            value.append(",TO_DATE('"+ DateUtil.parseDate(tcp.getCreatetime(),"yyyy-MM-dd HH:mm:ss") +"', 'YYYY-MM-DD HH24:MI:SS')");
        }
        if(tcp.getFlowid() != null && !"".equals(tcp.getFlowid())) {
            column.append(",FLOWID");
            value.append(",'"+tcp.getFlowid()+"'");
        }
        if(tcp.getLinkdepr() != null && !"".equals(tcp.getLinkdepr())) {
            column.append(",LINKDEPR");
            value.append(",'"+tcp.getLinkdepr()+"'");
        }
        if(tcp.getInspectionstatus() != null && !"".equals(tcp.getInspectionstatus())) {
            column.append(",INSPECTIONSTATUS");
            value.append(",'"+tcp.getInspectionstatus()+"'");
        }
        if(tcp.getInspectiondept() != null && !"".equals(tcp.getInspectiondept())) {
            column.append(",INSPECTIONDEPT");
            value.append(",'"+tcp.getInspectiondept()+"'");
        }

        column.append(")");
        value.append(")");
        String sql = column.toString()+value.toString();
        return sql;
    }
}
